package WizardInstall;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

/**
 * Check user is exist
 * @author Guy & Liel
 *
 */
class UserExistPage extends WizardPage {
	public static final String PAGE_NAME = "User";

	private Button buttonYes;
	private Button buttonNo;
	private Text textError;
	/**
	 * Constructor User exist page 
	 */
	public UserExistPage() {
		super(PAGE_NAME, "User Page", null);
	}
	/**
	 * Create the controls(buttons,Labels,text)
	 */
	public void createControl(Composite parent) 
	{
		Composite topLevel = new Composite(parent, SWT.NONE);
		topLevel.setLayout(new GridLayout(1, false));
		

		Label l = new Label(topLevel, SWT.LEFT);
		l.setText("Welcone to Clever DropBox installation \n\n\n Do you have an account?");


		buttonYes = new Button(topLevel, SWT.CHECK);
		buttonYes.setText("Yes");

		buttonNo = new Button(topLevel, SWT.CHECK);
		buttonNo.setText("No");
		
		
		textError = new Text(topLevel, SWT.SINGLE);
		textError.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		textError.setEnabled(false);
		
		
		setControl(topLevel);
		setPageComplete(true);
	}
	/**
	 * update text error
	 * @param strError
	 */
	public void updateLabelError(String strError)
	{
		textError.setText(strError);
	}
	/**
	 * get user have account
	 * @return String
	 */
	public boolean accountExist() {
		return buttonYes.getSelection();
	}
	/**
	 * Get user don't have account
	 * @return string
	 */
	public boolean accountNotExist() {
		return buttonNo.getSelection();
	}
}
